<!DOCTYPE>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>对象</title>
    <script src="js/traceur.js"></script>
    <script src="js/bootstrap.js"></script>

    <script>
        var x = 1, y = 2;
        var object = {
            x: x,
            y: y
        }
        console.log(object.x);

        //动态属性名
        var object2 = {};
        object2["first" + "Name"] = "Eden";
        console.log(object2["first" + "Name"]);
    </script>

    <script type="module">
        let x = 1, y = 2;
        let object = {x, y};
        console.log(object.x);

        //定义方法
        let object1 = {
            myFunction(){
                console.log("Hello World!"); //Hello World!
            }
        }
        object1.myFunction();

        //动态属性名
        let object2 = {
            ["first" + "Name"] : "Eden",
        }
        console.log(object2["first"+"Name"]); //Eden
    </script>
</head>
</html>